package utils

import (
	"container/list"
	"fmt"
	"os"
)

func PathExists(path string) bool {
	_, err := os.Stat(path)
	if err == nil {
		return true
	}

	if os.IsNotExist(err) {
		return false
	}
	return false
}

func SliceIter(items []string) {
	for i := 0; i < len(items); i++ {
		fmt.Println(items[i])
	}
	fmt.Println("Total:", len(items))
}

func ListIter(items *list.List) {
	for i := items.Front(); i != nil; i = i.Next() {
		fmt.Println(i.Value)
	}
	fmt.Println("Total:", items.Len())
}

func MapIter(items map[string]string) {
	for key, value := range items {
		fmt.Printf("%s\t%s\n", key, value)
		// fmt.Println(key, ",", value)
	}
	fmt.Println("Total:", len(items))
}
